package com.union.vehicleassistant.adapter;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.viewholder.BaseViewHolder;
import com.hjq.widget.layout.SettingView;
import com.union.vehicleassistant.R;
import com.union.vehicleassistant.bean.ChannelBean;
import com.union.vehicleassistant.util.UnitManager;

import java.util.List;

public class PreSettingAdapter extends BaseQuickAdapter<ChannelBean, BaseViewHolder> {

    public PreSettingAdapter(@Nullable List<ChannelBean> data) {
        super(R.layout.item_pre_setting, data);
    }

    @Override
    protected void convert(@NonNull BaseViewHolder baseViewHolder, ChannelBean channelBean) {
        SettingView settingView = baseViewHolder.getView(R.id.setting_view);
        int position = getItemPosition(channelBean);
        settingView.setLeftText(getContext().getString(R.string.setting_pre_setting) + (position + 1));
        settingView.setLeftSubText(getContext().getString(R.string.setting_channel_one) +
                UnitManager.getSuitPressure(channelBean.getChannelOne(), true) +
                "\t\t" +
                getContext().getString(R.string.setting_channel_two) +
                UnitManager.getSuitPressure(channelBean.getChannelTwo(), true));
    }
}
